<template>
  <div>
    <div class="ele-page-header">
      <div class="ele-page-title">扣点配置</div>
      <div class="ele-page-desc">
        用于扣点配置。
      </div>
    </div>
    <div class="ele-body">
      <el-card shadow="never">
        <el-form
          ref="form"
          :model="form"
          :rules="rules"
          label-width="230px"
          style=" margin: 10px auto"
        >

          <el-row>
            <el-col :sm="12">
              <el-form-item label="声音克隆标准版扣点:"  prop="voice_deduct">
                <el-input v-model="form.voice_deduct" clearable >
                  <template slot="append">点<em>/</em>次</template>
                </el-input>
              </el-form-item>

              <el-form-item label="声音克隆高保真扣点:"  prop="voice_high_deduct">
                <el-input v-model="form.voice_high_deduct" clearable >
                  <template slot="append">点<em>/</em>次</template>
                </el-input>
              </el-form-item>

              <el-form-item label="视频高级1创作扣点:"  prop="video_deduct">
                <el-input v-model="form.video_deduct" clearable >
                  <template slot="append">点<em>/</em>秒</template>
                </el-input>
              </el-form-item>

              <el-form-item label="视频标准创作扣点:"  prop="composite_deduct">
                <el-input v-model="form.composite_deduct" clearable >
                  <template slot="append">点<em>/</em>秒</template>
                </el-input>
              </el-form-item>

<el-form-item label="剪辑扣点:"  prop="clip_price">
                <el-input v-model="form.clip_price" clearable >
                  <template slot="append">每条</template>
                </el-input>
              </el-form-item>
              

            

            </el-col>
            <el-col :sm="12">
              <el-form-item label="形象克隆标准版扣点:"  prop="avatar_deduct">
                <el-input v-model="form.avatar_deduct" clearable >
                  <template slot="append">点<em>/</em>次</template>
                </el-input>
              </el-form-item>

              <el-form-item label="形象克隆高级版扣点:"  prop="avatar_high_deduct">
                <el-input v-model="form.avatar_high_deduct" clearable >
                  <template slot="append">点<em>/</em>次</template>
                </el-input>
              </el-form-item>

              <!-- <el-form-item label="视频换脸扣点:"  prop="face_deduct">
                <el-input v-model="form.face_deduct" clearable >
                  <template slot="append">点<em>/</em>秒</template>
                </el-input>
              </el-form-item>
             
              <el-form-item label="照片克隆高级版扣点:"  prop="photo_high_deduct">
                <el-input v-model="form.photo_high_deduct" clearable >
                  <template slot="append">点<em>/</em>次</template>
                </el-input>
              </el-form-item> -->
               <el-form-item label="视频高级2创作扣点:"  prop="woni_video_deduct">
                <el-input v-model="form.woni_video_deduct" clearable >
                   <template slot="append">点<em>/</em>分钟</template>
                </el-input>
              </el-form-item>

              <el-form-item label="AI文案扣点:"  prop="ai_create_deduct">
                <el-input v-model="form.ai_create_deduct" clearable >
                  <template slot="append">每条</template>
                </el-input>
              </el-form-item>

           
               <el-form-item label="ai视频提取文案扣点:"  prop="ai_video_extraction">
                <el-input v-model="form.ai_video_extraction" clearable >
                  <template slot="append">点<em>/</em>条</template>
                </el-input>
              </el-form-item>
            </el-col>

           
             
       
            
            



          </el-row> 

          <el-form-item>
            <el-button type="primary" :loading="loading" @click="submit">
              提交
            </el-button>
          </el-form-item>
        </el-form>
       
      </el-card>
    </div>
  </div>
</template>

<script>
  import { save ,query } from '@/api/system/config';

  export default {
    name: 'SetTally',
    data() {
      return {
        host:window.location.protocol + "//" +location.host,
        count:0,
        // 提交状态
        loading: false,
        disabled: false,
        // 表单数据
        form: {
          voice_deduct:'',
          voice_high_deduct:'',
          avatar_deduct: '',
          avatar_high_deduct: '',
          face_deduct: '',
          video_deduct:'',
          ai_create_deduct:'',
          photo_deduct:'',
          photo_high_deduct:'',
          composite_deduct:'',
        },
        // 表单验证规则
        rules: {    
          voice_deduct: [
            {
              required: true,
              message: '请输入点数',
              trigger: 'blur'
            }
          ],
          voice_high_deduct: [
            {
              required: true,
              message: '请输入点数',
              trigger: 'blur'
            }
          ],
          avatar_deduct: [
            {
              required: true,
              message: '请输入点数',
              trigger: 'blur'
            }
          ],
          avatar_high_deduct: [
            {
              required: true,
              message: '请输入点数',
              trigger: 'blur'
            }
          ],
          face_deduct: [
            {
              required: true,
              message: '请输入点数',
              trigger: 'blur'
            }
          ],
          video_deduct: [
            {
              required: true,
              message: '请输入点数',
              trigger: 'blur'
            }
          ],
          ai_create_deduct: [
            {
              required: true,
              message: '请输入字数',
              trigger: 'blur'
            }
          ],
          photo_deduct: [
            {
              required: true,
              message: '请输入点数',
              trigger: 'blur'
            }
          ],
          photo_high_deduct: [
            {
              required: true,
              message: '请输入点数',
              trigger: 'blur'
            }
          ],
          composite_deduct: [
            {
              required: true,
              message: '请输入点数',
              trigger: 'blur'
            }
          ],
        },
        // 表格列配置
        columns: [
          {
            prop: 'sign',
            label: '签名',
            showOverflowTooltip: true,
            minWidth: 110,
          },
          {
            prop: 'auditResult',
            label: '状态',
            showOverflowTooltip: true,
            minWidth: 110,
            slot: 'auditResult'
          }
        ],
        // 表格选中数据
        selection: [],
        // 当前编辑数据
        current: null,
        // 是否显示编辑弹窗
        showEdit: false,
      };
    },
    methods: {
     
      query(){
        query({group:'tally'}).then((data) => {
          if(data != null){
            this.form = data;  
            this.count = data?.count;
          }
          
        }).catch((e) => {
          this.$message.error(e.message);
        });
      },
      /* 提交 */
      submit() {
        this.$refs['form'].validate((valid) => {
          if (valid) {
            this.loading = true;
            save(this.form).then((msg) => {
              this.loading = false;
              this.$message.success(msg);
              this.query();
            })
            .catch((e) => {
              this.loading = false;
              this.$message.error(e.message);
            });
          } else {
            return false;
          }
        });
      },
      copy_url(content){
        if (window.clipboardData) {
          window.clipboardData.setData('text', content);
        } else {
          (function (content) {
            //oncopy 事件在用户拷贝元素上的内容时触发。
            document.oncopy = function (e) {
              e.clipboardData.setData('text', content);
              e.preventDefault(); //取消事件的默认动作
              document.oncopy = null;
            }
          })(content);
          document.execCommand('Copy');
        }
        this.$message.success('复制成功！');
      },
    },
    mounted() {
      this.query();
    }
    
  };
</script>
<style>
 .my_input{
  width: 400px;
 }
 .pay_header{
    margin-bottom: 30px;
    font-size: 17px;
  }
</style>
